<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'ttt.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript" src="dwz/js/jquery-1.7.2.js"></script>
<script type="text/javascript">
	$(function($) {
		$("#login").click( function () { 
			var url='login_UserInfo_ajax';
				params={
        			userId:$('#userName').attr('value'),
        			userPassword:$('#password').attr('value')
        		}
			 $.post(url,params,callbackFunction,'json');
				function callbackFunction(data){
					if(data.back=="读者"){
						window.location.href="reader.jsp";
					}else if(data.back=="图书管理员"){
						window.location.href="administrator.jsp";
					}else if(data.back=="系统管理员"){
						window.location.href="administrator.jsp";
					}else {
						alert(data.back);
					}
        		}
		});
});
	</script>
  </head>
  
  <body>
    <table width="100%" >
        <tr>
          <td align="right" valign="middle">用户名：</td>
          <td align="left"><input type="text" name="userId" id="userName" size="18"/></td>
        </tr>
        <tr height="50px">
          <td align="right">密&nbsp; &nbsp;码：</td>
          <td align="left"><input type="password" name="userPassword" id="password" /></td>
        </tr>
        <tr >
          <td align="right" valign="middle"><input type="button" value="" id="login"> </td>
          <td align="center" valign="middle"><input type="button" value="" id="register"></td>        
          </tr>
      </table>
  </body>
</html>
